package org.zhuxian.cn.service.impl;

import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.zhuxian.cn.entity.DTO.StatisticsDTO;
import org.zhuxian.cn.mapper.EquipmentBuildsMapper;
import org.zhuxian.cn.mapper.UserMapper;
import org.zhuxian.cn.service.StatisticsService;

@Service
@RequiredArgsConstructor
public class StatisticsServiceImpl implements StatisticsService {

    private final UserMapper userMapper;
    private final EquipmentBuildsMapper equipmentBuildsMapper;

    @Override
    public StatisticsDTO getSystemStatistics() {
        StatisticsDTO statisticsDTO = new StatisticsDTO();
        
        // 统计用户总数
        long userCount = userMapper.selectCount(null);
        statisticsDTO.setUserCount(userCount);
        
        // 统计配装总数
        long equipmentBuildsCount = equipmentBuildsMapper.selectCount(null);
        statisticsDTO.setEquipmentBuildsCount(equipmentBuildsCount);
        
        return statisticsDTO;
    }
}